import {createRouter, createWebHistory} from "vue-router";
import Login from "@/views/Login.vue";
import Layout from "@/views/Layout.vue";
import UserInfo from "@/views/user/UserInfo.vue";
import UserList from "@/views/user/UserList.vue";
import RestPassword from "@/views/user/RestPassword.vue";
import GoodsList from "@/views/goods/GoodsList.vue";
import NoticeList from "@/views/notice/NoticeList.vue";
import CommunicationList from "@/views/notice/CommunicationList.vue";
import InfoList from "@/views/notice/InfoList.vue";
import ShowList from "@/views/notice/ShowList.vue";
import StarList from "@/views/user/StarList.vue";
import IndexList from "@/views/notice/IndexList.vue";
import ComInfoList from "@/views/notice/ComInfoList.vue";
import WebList from "@/views/notice/WebList.vue";


// 定义路由关系
const routes = [
  {path: '/login', component: Login},  // 一级路由
  {
    path: '/',
    redirect: '/login',  // 重定向
    component: Layout,
    // 子路由
    children: [
      {path: '/user/list', component: UserList},
        //二级路由
      {path: '/notice/list', component: NoticeList},
      {path: '/show/list', component: ShowList},
      {path: '/communication/list', component: CommunicationList},
      {path: '/com_info/list', component:ComInfoList},
      {path: '/info/list', component: InfoList},
      {path: '/goods/list', component: GoodsList},
      {path: '/index/list', component: IndexList},
      {path: '/web/list', component: WebList},
      {path: '/user/info', component: UserInfo},
      {path: '/user/star', component: StarList},
      {path: '/user/resetPassword', component: RestPassword},

    ]
  },
]

// 创建路由器
const router = createRouter({
  history: createWebHistory(), // 路由模式
  routes: routes
})

//导出暴露
export default router
